Imports System 
Imports System.Text 
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Configuration 
Imports System.Xml 
Imports System.Xml.Serialization
Imports SubSonic 
Imports SubSonic.Utilities
Namespace Data
	''' <summary>
	''' Strongly-typed collection for the WebSettings class.
	''' </summary>
	<Serializable> _
	Public Partial Class WebSettingsCollection 
	Inherits ActiveList(Of WebSettings, WebSettingsCollection)
	    Public Sub New()
		End Sub
	End Class
	''' <summary>
	''' This is an ActiveRecord class which wraps the WebSettings table.
	''' </summary>
	<Serializable> _
	Public Partial Class WebSettings 
	Inherits ActiveRecord(Of WebSettings)
		#Region ".ctors and Default Settings"
		
		Public Sub New()
			SetSQLProps()
			InitSetDefaults()
			MarkNew()
		End Sub
		
		Public Sub New(ByVal useDatabaseDefaults As Boolean)
			SetSQLProps()
			If useDatabaseDefaults = True Then
				ForceDefaults()
			End If
			MarkNew()
		End Sub
		Public Sub New(ByVal keyID As Object)
			SetSQLProps()
			InitSetDefaults()
			LoadByKey(keyID)
		End Sub
		Public Sub New(ByVal columnName As String, ByVal columnValue As Object)
			SetSQLProps()
			InitSetDefaults()
			LoadByParam(columnName,columnValue)
		End Sub
		Private Sub InitSetDefaults()
			SetDefaults()
		End Sub
		
		Protected Shared Sub SetSQLProps()
			GetTableSchema()
		End Sub
		#End Region
		
		#Region "Schema and Query Accessor"
		
		Public Shared ReadOnly Property Schema() As TableSchema.Table
			Get
				If BaseSchema Is Nothing Then
					SetSQLProps()
				End If
				Return BaseSchema
			End Get
		End Property
		Private Shared Sub GetTableSchema()
			If (Not IsSchemaInitialized) Then
				'Schema declaration
				Dim schema As TableSchema.Table = New TableSchema.Table("WebSettings", TableType.Table, DataService.GetInstance("ClubStarterKitData"))
				schema.Columns = New TableSchema.TableColumnCollection()
				schema.SchemaName = "dbo"
				'columns
				
                
                Dim colvarId As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarId.ColumnName = "ID"
                colvarId.DataType = DbType.Int32
                colvarId.MaxLength = 0
                colvarId.AutoIncrement = true
                colvarId.IsNullable = false
                colvarId.IsPrimaryKey = true
                colvarId.IsForeignKey = false
                colvarId.IsReadOnly = false
                
                
                schema.Columns.Add(colvarId)
                
                Dim colvarName As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarName.ColumnName = "Name"
                colvarName.DataType = DbType.String
                colvarName.MaxLength = 50
                colvarName.AutoIncrement = false
                colvarName.IsNullable = false
                colvarName.IsPrimaryKey = false
                colvarName.IsForeignKey = false
                colvarName.IsReadOnly = false
                
                
                schema.Columns.Add(colvarName)
                
                Dim colvarSlogan As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarSlogan.ColumnName = "Slogan"
                colvarSlogan.DataType = DbType.String
                colvarSlogan.MaxLength = 50
                colvarSlogan.AutoIncrement = false
                colvarSlogan.IsNullable = false
                colvarSlogan.IsPrimaryKey = false
                colvarSlogan.IsForeignKey = false
                colvarSlogan.IsReadOnly = false
                
                
                schema.Columns.Add(colvarSlogan)
                
                Dim colvarCopyright As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarCopyright.ColumnName = "Copyright"
                colvarCopyright.DataType = DbType.String
                colvarCopyright.MaxLength = 50
                colvarCopyright.AutoIncrement = false
                colvarCopyright.IsNullable = false
                colvarCopyright.IsPrimaryKey = false
                colvarCopyright.IsForeignKey = false
                colvarCopyright.IsReadOnly = false
                
                
                schema.Columns.Add(colvarCopyright)
                
                Dim colvarAddress As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarAddress.ColumnName = "Address"
                colvarAddress.DataType = DbType.String
                colvarAddress.MaxLength = 50
                colvarAddress.AutoIncrement = false
                colvarAddress.IsNullable = false
                colvarAddress.IsPrimaryKey = false
                colvarAddress.IsForeignKey = false
                colvarAddress.IsReadOnly = false
                
                
                schema.Columns.Add(colvarAddress)
                
                Dim colvarSiteURL As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarSiteURL.ColumnName = "SiteURL"
                colvarSiteURL.DataType = DbType.String
                colvarSiteURL.MaxLength = -1
                colvarSiteURL.AutoIncrement = false
                colvarSiteURL.IsNullable = false
                colvarSiteURL.IsPrimaryKey = false
                colvarSiteURL.IsForeignKey = false
                colvarSiteURL.IsReadOnly = false
                
                
                schema.Columns.Add(colvarSiteURL)
                
                Dim colvarMailServer As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarMailServer.ColumnName = "MailServer"
                colvarMailServer.DataType = DbType.String
                colvarMailServer.MaxLength = 50
                colvarMailServer.AutoIncrement = false
                colvarMailServer.IsNullable = false
                colvarMailServer.IsPrimaryKey = false
                colvarMailServer.IsForeignKey = false
                colvarMailServer.IsReadOnly = false
                
                
                schema.Columns.Add(colvarMailServer)
                
                Dim colvarMailUsername As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarMailUsername.ColumnName = "MailUsername"
                colvarMailUsername.DataType = DbType.String
                colvarMailUsername.MaxLength = 50
                colvarMailUsername.AutoIncrement = false
                colvarMailUsername.IsNullable = false
                colvarMailUsername.IsPrimaryKey = false
                colvarMailUsername.IsForeignKey = false
                colvarMailUsername.IsReadOnly = false
                
                
                schema.Columns.Add(colvarMailUsername)
                
                Dim colvarMailPassword As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarMailPassword.ColumnName = "MailPassword"
                colvarMailPassword.DataType = DbType.String
                colvarMailPassword.MaxLength = 50
                colvarMailPassword.AutoIncrement = false
                colvarMailPassword.IsNullable = false
                colvarMailPassword.IsPrimaryKey = false
                colvarMailPassword.IsForeignKey = false
                colvarMailPassword.IsReadOnly = false
                
                
                schema.Columns.Add(colvarMailPassword)
                
                Dim colvarEmailVerification As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarEmailVerification.ColumnName = "EmailVerification"
                colvarEmailVerification.DataType = DbType.Boolean
                colvarEmailVerification.MaxLength = 0
                colvarEmailVerification.AutoIncrement = false
                colvarEmailVerification.IsNullable = false
                colvarEmailVerification.IsPrimaryKey = false
                colvarEmailVerification.IsForeignKey = false
                colvarEmailVerification.IsReadOnly = false
                
                
                schema.Columns.Add(colvarEmailVerification)
                
                Dim colvarAdminVerification As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarAdminVerification.ColumnName = "AdminVerification"
                colvarAdminVerification.DataType = DbType.Boolean
                colvarAdminVerification.MaxLength = 0
                colvarAdminVerification.AutoIncrement = false
                colvarAdminVerification.IsNullable = false
                colvarAdminVerification.IsPrimaryKey = false
                colvarAdminVerification.IsForeignKey = false
                colvarAdminVerification.IsReadOnly = false
                
                
                schema.Columns.Add(colvarAdminVerification)
                
                Dim colvarPageSize As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarPageSize.ColumnName = "PageSize"
                colvarPageSize.DataType = DbType.Int32
                colvarPageSize.MaxLength = 0
                colvarPageSize.AutoIncrement = false
                colvarPageSize.IsNullable = false
                colvarPageSize.IsPrimaryKey = false
                colvarPageSize.IsForeignKey = false
                colvarPageSize.IsReadOnly = false
                
                
                schema.Columns.Add(colvarPageSize)
                
                Dim colvarReportCMS As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarReportCMS.ColumnName = "ReportCMS"
                colvarReportCMS.DataType = DbType.Boolean
                colvarReportCMS.MaxLength = 0
                colvarReportCMS.AutoIncrement = false
                colvarReportCMS.IsNullable = false
                colvarReportCMS.IsPrimaryKey = false
                colvarReportCMS.IsForeignKey = false
                colvarReportCMS.IsReadOnly = false
                
                
                schema.Columns.Add(colvarReportCMS)
                
                Dim colvarWebmaster As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarWebmaster.ColumnName = "Webmaster"
                colvarWebmaster.DataType = DbType.String
                colvarWebmaster.MaxLength = 50
                colvarWebmaster.AutoIncrement = false
                colvarWebmaster.IsNullable = false
                colvarWebmaster.IsPrimaryKey = false
                colvarWebmaster.IsForeignKey = false
                colvarWebmaster.IsReadOnly = false
                
                
                schema.Columns.Add(colvarWebmaster)
                
                Dim colvarIsHighestWinner As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarIsHighestWinner.ColumnName = "IsHighestWinner"
                colvarIsHighestWinner.DataType = DbType.Boolean
                colvarIsHighestWinner.MaxLength = 0
                colvarIsHighestWinner.AutoIncrement = false
                colvarIsHighestWinner.IsNullable = false
                colvarIsHighestWinner.IsPrimaryKey = false
                colvarIsHighestWinner.IsForeignKey = false
                colvarIsHighestWinner.IsReadOnly = false
                
                
                schema.Columns.Add(colvarIsHighestWinner)
                
                Dim colvarModerationLevel As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarModerationLevel.ColumnName = "ModerationLevel"
                colvarModerationLevel.DataType = DbType.Int32
                colvarModerationLevel.MaxLength = 0
                colvarModerationLevel.AutoIncrement = false
                colvarModerationLevel.IsNullable = false
                colvarModerationLevel.IsPrimaryKey = false
                colvarModerationLevel.IsForeignKey = false
                colvarModerationLevel.IsReadOnly = false
                
                
                schema.Columns.Add(colvarModerationLevel)
                
                Dim colvarCurrentSeason As TableSchema.TableColumn = New TableSchema.TableColumn(schema)
                colvarCurrentSeason.ColumnName = "CurrentSeason"
                colvarCurrentSeason.DataType = DbType.Int32
                colvarCurrentSeason.MaxLength = 0
                colvarCurrentSeason.AutoIncrement = false
                colvarCurrentSeason.IsNullable = false
                colvarCurrentSeason.IsPrimaryKey = false
                colvarCurrentSeason.IsForeignKey = false
                colvarCurrentSeason.IsReadOnly = false
                
                
                schema.Columns.Add(colvarCurrentSeason)
                
				BaseSchema = schema
				
				'add this schema to the provider
                'so we can query it later
                DataService.Providers("ClubStarterKitData").AddSchema("WebSettings",schema)
			End If
		End Sub
		Public Shared Function CreateQuery() As Query
			Return New Query(Schema)
		End Function
		
		#End Region
		
		#Region "Props"
	
          
        <XmlAttribute("Id")> _
        Public Property Id As Integer 
			Get
				Return GetColumnValue(Of Integer)("ID")
			End Get
		    
			Set
				SetColumnValue("ID", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("Name")> _
        Public Property Name As String 
			Get
				Return GetColumnValue(Of String)("Name")
			End Get
		    
			Set
				SetColumnValue("Name", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("Slogan")> _
        Public Property Slogan As String 
			Get
				Return GetColumnValue(Of String)("Slogan")
			End Get
		    
			Set
				SetColumnValue("Slogan", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("Copyright")> _
        Public Property Copyright As String 
			Get
				Return GetColumnValue(Of String)("Copyright")
			End Get
		    
			Set
				SetColumnValue("Copyright", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("Address")> _
        Public Property Address As String 
			Get
				Return GetColumnValue(Of String)("Address")
			End Get
		    
			Set
				SetColumnValue("Address", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("SiteURL")> _
        Public Property SiteURL As String 
			Get
				Return GetColumnValue(Of String)("SiteURL")
			End Get
		    
			Set
				SetColumnValue("SiteURL", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("MailServer")> _
        Public Property MailServer As String 
			Get
				Return GetColumnValue(Of String)("MailServer")
			End Get
		    
			Set
				SetColumnValue("MailServer", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("MailUsername")> _
        Public Property MailUsername As String 
			Get
				Return GetColumnValue(Of String)("MailUsername")
			End Get
		    
			Set
				SetColumnValue("MailUsername", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("MailPassword")> _
        Public Property MailPassword As String 
			Get
				Return GetColumnValue(Of String)("MailPassword")
			End Get
		    
			Set
				SetColumnValue("MailPassword", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("EmailVerification")> _
        Public Property EmailVerification As Boolean 
			Get
				Return GetColumnValue(Of Boolean)("EmailVerification")
			End Get
		    
			Set
				SetColumnValue("EmailVerification", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("AdminVerification")> _
        Public Property AdminVerification As Boolean 
			Get
				Return GetColumnValue(Of Boolean)("AdminVerification")
			End Get
		    
			Set
				SetColumnValue("AdminVerification", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("PageSize")> _
        Public Property PageSize As Integer 
			Get
				Return GetColumnValue(Of Integer)("PageSize")
			End Get
		    
			Set
				SetColumnValue("PageSize", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("ReportCMS")> _
        Public Property ReportCMS As Boolean 
			Get
				Return GetColumnValue(Of Boolean)("ReportCMS")
			End Get
		    
			Set
				SetColumnValue("ReportCMS", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("Webmaster")> _
        Public Property Webmaster As String 
			Get
				Return GetColumnValue(Of String)("Webmaster")
			End Get
		    
			Set
				SetColumnValue("Webmaster", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("IsHighestWinner")> _
        Public Property IsHighestWinner As Boolean 
			Get
				Return GetColumnValue(Of Boolean)("IsHighestWinner")
			End Get
		    
			Set
				SetColumnValue("IsHighestWinner", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("ModerationLevel")> _
        Public Property ModerationLevel As Integer 
			Get
				Return GetColumnValue(Of Integer)("ModerationLevel")
			End Get
		    
			Set
				SetColumnValue("ModerationLevel", Value)
			End Set
		End Property
		
		
		  
        <XmlAttribute("CurrentSeason")> _
        Public Property CurrentSeason As Integer 
			Get
				Return GetColumnValue(Of Integer)("CurrentSeason")
			End Get
		    
			Set
				SetColumnValue("CurrentSeason", Value)
			End Set
		End Property
		
		
		
		
		#End Region
		
		
			    
	    
		
		
		
		
		
	    
	    'no foreign key tables defined (0)
	    
		
	    
	    'no ManyToMany tables defined (0)
	    
		
		#Region "ObjectDataSource support"
		
		''' <summary>
		''' Inserts a record, can be used with the Object Data Source
		''' </summary>
		Public Shared Sub Insert(ByVal varName As String,ByVal varSlogan As String,ByVal varCopyright As String,ByVal varAddress As String,ByVal varSiteURL As String,ByVal varMailServer As String,ByVal varMailUsername As String,ByVal varMailPassword As String,ByVal varEmailVerification As Boolean,ByVal varAdminVerification As Boolean,ByVal varPageSize As Integer,ByVal varReportCMS As Boolean,ByVal varWebmaster As String,ByVal varIsHighestWinner As Boolean,ByVal varModerationLevel As Integer,ByVal varCurrentSeason As Integer)
			Dim item As WebSettings = New WebSettings()
			
            item.Name = varName
            
            item.Slogan = varSlogan
            
            item.Copyright = varCopyright
            
            item.Address = varAddress
            
            item.SiteURL = varSiteURL
            
            item.MailServer = varMailServer
            
            item.MailUsername = varMailUsername
            
            item.MailPassword = varMailPassword
            
            item.EmailVerification = varEmailVerification
            
            item.AdminVerification = varAdminVerification
            
            item.PageSize = varPageSize
            
            item.ReportCMS = varReportCMS
            
            item.Webmaster = varWebmaster
            
            item.IsHighestWinner = varIsHighestWinner
            
            item.ModerationLevel = varModerationLevel
            
            item.CurrentSeason = varCurrentSeason
            
			If Not System.Web.HttpContext.Current Is Nothing Then
				item.Save(System.Web.HttpContext.Current.User.Identity.Name)
			Else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name)
			End If
		End Sub
		''' <summary>
		''' Updates a record, can be used with the Object Data Source
		''' </summary>
		Public Shared Sub Update(ByVal varId As Integer,ByVal varName As String,ByVal varSlogan As String,ByVal varCopyright As String,ByVal varAddress As String,ByVal varSiteURL As String,ByVal varMailServer As String,ByVal varMailUsername As String,ByVal varMailPassword As String,ByVal varEmailVerification As Boolean,ByVal varAdminVerification As Boolean,ByVal varPageSize As Integer,ByVal varReportCMS As Boolean,ByVal varWebmaster As String,ByVal varIsHighestWinner As Boolean,ByVal varModerationLevel As Integer,ByVal varCurrentSeason As Integer)
			Dim item As WebSettings = New WebSettings()
		    
                item.Id = varId
				
                item.Name = varName
				
                item.Slogan = varSlogan
				
                item.Copyright = varCopyright
				
                item.Address = varAddress
				
                item.SiteURL = varSiteURL
				
                item.MailServer = varMailServer
				
                item.MailUsername = varMailUsername
				
                item.MailPassword = varMailPassword
				
                item.EmailVerification = varEmailVerification
				
                item.AdminVerification = varAdminVerification
				
                item.PageSize = varPageSize
				
                item.ReportCMS = varReportCMS
				
                item.Webmaster = varWebmaster
				
                item.IsHighestWinner = varIsHighestWinner
				
                item.ModerationLevel = varModerationLevel
				
                item.CurrentSeason = varCurrentSeason
				
			item.IsNew = False
			If Not System.Web.HttpContext.Current Is Nothing Then
				item.Save(System.Web.HttpContext.Current.User.Identity.Name)
			Else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name)
			End If
		End Sub
		#End Region
		#Region "Columns Struct"
		Public Structure Columns
			Dim x as Integer
			
            Public Shared Id As String = "ID"
            
            Public Shared Name As String = "Name"
            
            Public Shared Slogan As String = "Slogan"
            
            Public Shared Copyright As String = "Copyright"
            
            Public Shared Address As String = "Address"
            
            Public Shared SiteURL As String = "SiteURL"
            
            Public Shared MailServer As String = "MailServer"
            
            Public Shared MailUsername As String = "MailUsername"
            
            Public Shared MailPassword As String = "MailPassword"
            
            Public Shared EmailVerification As String = "EmailVerification"
            
            Public Shared AdminVerification As String = "AdminVerification"
            
            Public Shared PageSize As String = "PageSize"
            
            Public Shared ReportCMS As String = "ReportCMS"
            
            Public Shared Webmaster As String = "Webmaster"
            
            Public Shared IsHighestWinner As String = "IsHighestWinner"
            
            Public Shared ModerationLevel As String = "ModerationLevel"
            
            Public Shared CurrentSeason As String = "CurrentSeason"
            
		End Structure
		#End Region
	End Class
End Namespace
